Skip to content

Conversation

lposen
Copy link
Contributor

@lposen lposen commented Oct 3, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

Adds tests for IterableUtil

Copy link

github-actions bot commented Oct 3, 2025

Lines Statements Branches Functions
Coverage: 49%
48.62% (230/473) 21.22% (38/179) 41.29% (64/155)

Copy link

qltysh bot commented Oct 3, 2025

Diff Coverage: Not applicable. There was no coverage data reported for the files in this diff.

Total Coverage: This PR will increase coverage by 0.21%.

File Coverage Changes
Path File Coverage Δ Indirect
src/core/classes/IterableUtil.ts 33.3
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@lposen lposen requested a review from Copilot October 10, 2025 17:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for the IterableUtil class, specifically focusing on the readBoolean method. The tests document the current behavior where the method doesn't strictly validate boolean types but returns truthy values as-is and falsy values as false.

  • Adds 15 test cases covering various scenarios including boolean values, falsy values, truthy non-boolean values, and edge cases
  • Documents current implementation limitations through comments and TODO items
  • Provides test coverage for key existence checks and case sensitivity

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +109 to +110
// THEN it should return the string cast to boolean (truthy)
expect(result).toBe('true');
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the string as being 'cast to boolean (truthy)' but the test expects the original string value 'true', not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.

Copilot uses AI. Check for mistakes.

// WHEN reading the boolean value
const result = IterableUtil.readBoolean(dict, 'testKey');

// THEN it should return the number cast to boolean (truthy)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the number as being 'cast to boolean (truthy)' but the test expects the original number value 1, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.

Suggested change
// THEN it should return the number cast to boolean (truthy)
// THEN it should return the original number value (since it is truthy)

Copilot uses AI. Check for mistakes.

Comment on lines +133 to +134
// THEN it should return the object cast to boolean (truthy)
expect(result).toEqual({});
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the object as being 'cast to boolean (truthy)' but the test expects the original object value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.

Copilot uses AI. Check for mistakes.

// WHEN reading the boolean value
const result = IterableUtil.readBoolean(dict, 'testKey');

// THEN it should return the array cast to boolean (truthy)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the array as being 'cast to boolean (truthy)' but the test expects the original array value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.

Suggested change
// THEN it should return the array cast to boolean (truthy)
// THEN it should return the array value as-is (since arrays are truthy)

Copilot uses AI. Check for mistakes.

Comment on lines +157 to +158
// THEN it should return the function cast to boolean (truthy)
expect(result).toBeInstanceOf(Function);
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment describes the function as being 'cast to boolean (truthy)' but the test expects the original function value, not a boolean. The comment should clarify that truthy values are returned as-is, not cast to boolean.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant